package com.bjsxt.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bjsxt.domain.CashRecharge;
import com.bjsxt.domain.CashWithdrawals;
import com.bjsxt.domain.CoinRecharge;
import com.bjsxt.model.R;
import com.bjsxt.service.CoinRechargeService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

@RestController
@RequestMapping("/coinRecharges")
@Api(tags = "充币记录")
public class CoinRechargeController {

    @Autowired
    private CoinRechargeService coinRechargeService;

    @GetMapping("/records")
    public R<Page<CoinRecharge>> findByPage(
            @ApiIgnore Page<CoinRecharge> page,
            Long userId, String userName, String mobile,
            Byte status, String numMin, String numMax,
            String startTime, String endTime
    ){
        Page<CoinRecharge> pageData  =   coinRechargeService.findByPage(page, userId, userName, mobile, status, numMin, numMax, startTime, endTime);
        return R.fail();
    }
        @GetMapping("/user/record")
        public R<Page<CoinRecharge>> findUserCoinRecharge(Page<CoinRecharge> page,Long coinId){
        Long userId = Long.valueOf(SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString());

         Page<CoinRecharge> page1  =    coinRechargeService.findUserCoinRecharge(page,coinId,userId);

                return R.ok(page1);
    }

}
